﻿namespace movie.tool.module.film.model
{
    public class TaskProgress
    {
        public static readonly int STATUS_SUCCEED = 0;
        public static readonly int STATUS_IN_PROGRESS = 1;
        public static readonly int STATUS_FAILED = -1;

        /// <summary>
        /// 任务的id.跟TaskKey的Key属性一致
        /// </summary>
        public string Id { get; set; }
        /// <summary>
        /// 任务状态0为成功,1为进行中,-1为失败
        /// </summary>
        public int Status { get; set; }
        /// <summary>
        /// 进度百分比，比如65%，那值就是65;
        /// </summary>
        public int Percent { get; set; }
        /// <summary>
        /// 任务的提示消息
        /// </summary>
        public string Message { get; set; }

        /// <summary>
        /// 任务是否已经失败
        /// </summary>
        /// <returns>true表示已经失败否则未失败,那可能成功也可能还在进行</returns>
        public bool Failed()
        {
            return Status == STATUS_FAILED;
        }

        public void tt() { }
        /// <summary>
        /// 任务是否已经成功完成
        /// </summary>
        /// <returns>true表示成功完成,否则可能已经失败或者还在进行中</returns>
        public bool Succeed()
        {
            return Status == STATUS_SUCCEED;
        }
    }
}
